/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package src;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

/**
 *
 * @author administrador
 */
public class OpenLowBrowser extends Thread
{
    JFrame notify = new JFrame();

    String adress;



    public OpenLowBrowser( String address )
    {
        this.adress = address;
    }

    @Override
    public void run()
    {
        try
        {
            JButton cancel = new JButton( "Cancelar" );
            cancel.addActionListener( new ActionListener()
            {

                public void actionPerformed( ActionEvent e )
                {
                    stop();
                    notify.setVisible( false );
                }
            } );

            Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            int posX = ( ( dim.width / 2 ) - ( 300 / 2 ) );
            int posY = ( ( dim.height / 2 ) - ( 50 / 2 ) );

            FlowLayout layout = new FlowLayout();

            JLabel notLabel = new JLabel( "Loading... " );

            cancel.setEnabled( true );
            
            notify.setLocation( posX, posY );
            notify.setSize( 400, 60 );
            notify.setLayout( layout );
            notify.add( notLabel );
            notify.add( cancel );
            notify.setVisible( true );
            notify.setAlwaysOnTop( true );


            Degub.getInstance().Debug( "Opening" + adress );
            //new OpenUrl( adress );

            notify.setVisible( false );
            notify.removeAll();
        }
        catch ( Exception ex )
        {
            Degub.getInstance().Debug( ex.getMessage() );
        }
    }
}



